Micron Document
🎖️GitЯра🎖️

Commit 3c7e1266f819f90df2bfca6717cd1df0414d6c3a


Parents : 743851b
Author : James Rich <2199651+jamesarich@users.noreply.github.com>
Signature : Signature validation error
Date : 2026-04-14T06:01:03-05:00
Committer : GitHub <noreply@github.com>
Date : 2026-04-14T11:01:03Z

fix: truncate traceroute chart x-values to whole seconds to prevent Vico crash (#5122)

Changes
Diff

diff --git a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/TracerouteChart.kt b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/TracerouteChart.kt
index ce63002057..c1e5e69fe7 100644
--- a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/TracerouteChart.kt
+++ b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/TracerouteChart.kt
@@ -112,7 +112,7 @@ internal fun resolveTraceroutePoints(requests: List<MeshLog>, results: List<Mesh
val requestPacketId = request.fromRadio.packet?.id
val result = results.find { it.fromRadio.packet?.decoded?.request_id == requestPacketId }
val route = result?.fromRadio?.packet?.fullRouteDiscovery
- val timeSeconds = request.received_date.toDouble() / MS_PER_SEC
+ val timeSeconds = (request.received_date / MS_PER_SEC).toDouble()
val forwardHops = route?.let { maxOf(0, it.route.size - 2) }
val returnHops = route?.let { if (it.route_back.isNotEmpty()) maxOf(0, it.route_back.size - 2) else null }

diff --git a/feature/node/src/commonTest/kotlin/org/meshtastic/feature/node/metrics/TracerouteChartTest.kt b/feature/node/src/commonTest/kotlin/org/meshtastic/feature/node/metrics/TracerouteChartTest.kt
index 060925fb37..a80b2172ed 100644
--- a/feature/node/src/commonTest/kotlin/org/meshtastic/feature/node/metrics/TracerouteChartTest.kt
+++ b/feature/node/src/commonTest/kotlin/org/meshtastic/feature/node/metrics/TracerouteChartTest.kt
@@ -241,6 +241,19 @@ class TracerouteChartTest {
assertNull(point.returnHops)
}
+ @Test
+ fun timeSeconds_truncatesSubSecondPrecision() {
+ // received_date with sub-second remainder (e.g. 1000 seconds + 456 ms)
+ val requestTime = 1000L * MS_PER_SEC + 456L
+ val requests = listOf(makeRequest(id = 1, receivedDateMillis = requestTime))
+ val results = emptyList<MeshLog>()
+
+ val point = resolveTraceroutePoints(requests, results).first()
+
+ // Must truncate to whole seconds to avoid Vico "x-values are too precise" crash
+ assertEquals(1000.0, point.timeSeconds)
+ }
+
@Test
fun returnHops_computedWhenRouteBackAvailable() {
val requests = listOf(makeRequest(id = 1, receivedDateMillis = 1000L * MS_PER_SEC))

Served by rngit 1.5.2 - Generated in 0.12s